import React, { Component } from 'react';
import PropTypes from "prop-types"
import {Form,Input} from "antd"
const Item=Form.Item
class Updataform extends Component {
     //接受得参数进行类型校验
    static propTtpes={
       categoryName:PropTypes.string.isRequired,
       setForm:PropTypes.func.isRequired,
    }
    componentWillMount(){
        this.props.setForm(this.props.form)
    }
    constructor(props) {
        super(props);
        this.state = {  }
    }
    render() { 
        const {categoryName}=this.props
        const { getFieldDecorator } = this.props.form;//获取表单实例
        return (<>
         <Form onSubmit={this.handleSubmit} className="login-form">
        <Item>
          {getFieldDecorator('categoryName', {
              initialValue:categoryName,
            rules: [{ required: true, message: '名字必须' }],
          })(
            <Input placeholder="请输入分类名称"
            />,
          )}
        </Item>
       
      </Form>
        </>  );
    }
}
 
export default Form.create()(Updataform);